//
//  HeaderOfClickZhuanTiCell.m
//  SeeTheWorld
//
//  Created by dllo on 16/1/26.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "HeaderOfClickZhuanTiCell.h"
#import "ModelOfClickZhuanTiCell.h"
#import "PCH.pch"
#import <UIImageView+WebCache.h>

@interface HeaderOfClickZhuanTiCell ()

@property (nonatomic, retain)UIImageView *imageViewOfBack;
@property (nonatomic, retain)UILabel *labelOfName;
@property (nonatomic, retain)UIView *viewOfWhite;
@property (nonatomic, retain)UILabel *labelOfTitle;

@end

@implementation HeaderOfClickZhuanTiCell

- (void)dealloc {
    [_labelOfTitle release];
    [_viewOfWhite release];
    [_labelOfName release];
    [_imageViewOfBack release];
    [super dealloc];
}

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createSubviews];
        
    }
    
    return self;
}

#pragma mark - 创建子视图
- (void)createSubviews {
    
    self.imageViewOfBack = [[UIImageView alloc] init];
    [self.contentView addSubview:self.imageViewOfBack];
    [_imageViewOfBack release];
   
    self.labelOfName = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelOfName];
    [_labelOfName release];
    self.labelOfName.textColor = [UIColor whiteColor];
    self.labelOfName.font = [UIFont systemFontOfSize:25];
    self.labelOfName.textAlignment = NSTextAlignmentCenter;
    
    self.viewOfWhite = [[UIView alloc] init];
    [self.contentView addSubview:self.viewOfWhite];
    [_viewOfWhite release];
    self.viewOfWhite.backgroundColor = [UIColor whiteColor];
    
    self.labelOfTitle = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelOfTitle];
    [_labelOfTitle release];
    self.labelOfTitle.textColor = [UIColor whiteColor];
    self.labelOfTitle.textAlignment = NSTextAlignmentCenter;
    self.labelOfTitle.font = [UIFont systemFontOfSize:15];
    
}

#pragma mark - 布局子视图
- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.imageViewOfBack.frame = self.contentView.frame;
    self.labelOfName.frame = CGRectMake(10, 45, WIDTH - 20, 40);
    self.viewOfWhite.frame = CGRectMake(65, 90, WIDTH - 130, 1);
    self.labelOfTitle.frame = CGRectMake(50, 95, WIDTH - 100, 40);
    
}

#pragma mark - 赋值
- (void)passModel:(ModelOfClickZhuanTiCell *)model {
    
    [self.imageViewOfBack sd_setImageWithURL:[NSURL URLWithString:model.image_url] placeholderImage:[UIImage imageNamed:@"1f178a82b9014a90e9109296ad773912b31beeeb"]];
    self.labelOfName.text = model.name;
    self.labelOfTitle.text = model.title;
}













@end
